<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file="../../../common/common-jstl.jspf" %>
<%@ include file="../../../common/common-easyui.jspf" %>
<!doctype html>
<html lang="en">
<head>
    <base href="${pageContext.request.contextPath }/">
    <meta charset="UTF-8">
    <title>开始考试</title>

</head>
<body>
<div class="container">
    <select id="courseId" name="courseId">
        <option value="-1">--请选择科目--</option>
        <c:forEach items="${courseList }" var="course">
            <option value="${course.courseId }">${course.courseName }</option>
        </c:forEach>
    </select>
    <input type="button" value="开始考试"/>
</div>
<!-- 弹出层 -->
<div id="promptDiv" style="display:none;"></div>
<script type="text/javascript">
    $(function () {
        $(":button").on("click", function () {
            $.get("examController?flag=start_exam", {courseId: $("#courseId").val()}, function (data) {
                if (data == "no") {
                    $.messager.alert("提示", "暂无考试安排", 'info');
                } else {
                    exam(data);
                    //location.href="examController?flag=exam&paperId="+data;
                }
            });
        });
    });
    //开始考试
    function exam(paperId) {
        $("#promptDiv").dialog({
            title: "题型窗口",
            width: '100%',
            height: '100%',
            modal: true,
            href: 'examController?flag=exam&paperId=' + paperId,
            /* buttons:[{
             text:"确定",
             handler:function() {
             // 关闭模态
             $('#promptDiv').dialog('close');
             }
             }] */
        });
    }
</script>
</body>
</html>